﻿/****************************************************************************************
 * Copyright © 2020 - 2023 by AngryKeyboard.
 * SFML_俄罗斯方块 is licensed under MulanOWL BY v1.
 * You can use this software according to the terms and conditions of the MulanOWL BY v1.
 * You may obtain a copy of MulanOWL BY v1 at:
 *          http://license.coscl.org.cn/MulanOWLBYv1
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the MulanOWL BY v1 for more details.
****************************************************************************************/
#pragma once

/*************
游戏设定相关参数
*************/
const int ROW_COUNT = 20; //游戏区域的行数
const int COL_COUNT = 10; //游戏区域的列数
enum HardLevel        //难度等级
{
  HARD_LEVEL_EASY, HARD_LEVEL_NORMAL, HARD_LEVEL_CHALLENGE,
  HARD_LEVEL_COUNT
};

/**********
方块相关参数
**********/
//方块生成间隔（秒）
const float BORN_CD_EASY = 5;
const float BORN_CD_NORMAL = 3;
const float BORN_CD_CHALLENGE = 1;

//方块下落间隔时间（秒）
const float SPEED_EASY = 0.5;
const float SPEED_NORMAL = 0.3;
const float SPEED_CHALLENGE = 0.2;
const float SPEED_QUICK = 0.04;

//不同形状方块对应的索引
enum BlockIndex {
  //方块的形状
  I,
  L,
  J,
  T,
  S,
  Z,
  O,
  BLOCK_TYPE_COUNT    //方块形状数量
};
const int BLOCK_POINT_COUNT = 4;  //每个方块有4个点

//方块形状
const int BLOCKS[BLOCK_TYPE_COUNT][BLOCK_POINT_COUNT] = {
  /*
  方块区域划分如下：
  ***********
  * 0 2 4 6 *
  * 1 3 5 7 *
  ***********
  */
  0,2,4,6, // I
  3,5,7,6, // L
  7,5,3,2, // J
  3,5,4,7, // T
  3,5,4,6, // S
  2,4,5,7, // Z
  2,3,4,5, // O
};

//方块方向
enum BlockDirection {
  UP, RIGHT, DOWN, LEFT,
  DIRECTION_COUNT
};

//方块旋转方向
enum BlockRotateDirection {
  CLOCKWISE = 1,    //顺时针
  ANTICLOCKWISE = -1  //逆时针
};

/**********
绘图相关参数
**********/
const int WINDOW_WIDTH = 320; //游戏界面宽度（像素）
const int WINDOW_HEIGHT = 416;  //游戏界面高度（像素）
const int POINT_WIDTH = 18; //方块每个点的宽度（像素）
const int LEFT_MARGIN = 28; //游戏区左边界离窗口的宽度（像素）
const int TOP_MARGIN = 31;  //游戏区上边界离窗口的宽度（像素）
